package com.example.topic;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author: dangwen
 * @createDate: 2020/12/6
 * 发送消息到主题交换器
 */
@Component
public class TopicMessageSender {

    @Resource
    private AmqpTemplate amqpTemplate;

    public void sendTopicMessage(String exchangeName, String routingKey, String message){
        amqpTemplate.convertAndSend(exchangeName, routingKey, message);
    }
}
